﻿<!--/* 
* Copyright (c) 2010, The University of Texas at Austin
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, 
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, 
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, 
* this list of conditions and the following disclaimer in the documentation and/or other materials 
* provided with the distribution.
*
* Neither the name of The University of Texas at Austin nor the names of its contributors may be 
* used to endorse or promote products derived from this software without specific prior written 
* permission.
* 
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 
* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/-->
<ResourceDictionary x:Class="Bio.Views.Structure.Editor.Resources.DataTemplates"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:sys="clr-namespace:System;assembly=mscorlib"
                    xmlns:Visuals="clr-namespace:Bio.Views.Structure.Editor.Internal.Rendering.Visuals"
                    xmlns:Rendering="clr-namespace:Bio.Views.Structure.Editor.Internal.Rendering"
                    xmlns:Converters="clr-namespace:Bio.Views.Structure.Editor.Internal.Converters"
                    xmlns:Interactivity="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
                    xmlns:SECommands="clr-namespace:Bio.Views.Structure.Editor.Internal.Commands"
                    xmlns:SEBehaviors="clr-namespace:Bio.Views.Structure.Editor.Internal.Behaviors"
                    xmlns:ViewModels="clr-namespace:Bio.Views.Structure.Editor.ViewModels"
                    xmlns:julmar="http://www.julmar.com/wpfhelpers">  
    <x:Array Type="sys:Double" x:Key="ValidNucleotideFontSizes">
        <sys:Double>6</sys:Double>
        <sys:Double>8</sys:Double>
        <sys:Double>10</sys:Double>
        <sys:Double>11</sys:Double>
        <sys:Double>12</sys:Double>
        <sys:Double>14</sys:Double>
        <sys:Double>16</sys:Double>
        <sys:Double>18</sys:Double>
        <sys:Double>20</sys:Double>
        <sys:Double>24</sys:Double>
        <sys:Double>-1</sys:Double>
    </x:Array>
    
    <Style x:Key="ContextMenuItemStyle" TargetType="MenuItem" BasedOn="{StaticResource {x:Type MenuItem}}">
        <Setter Property="Header" Value="{Binding Text}"/>
        <!--<Setter Property="Icon" Value="{Binding Icon}" />-->
        <Setter Property="ItemsSource" Value="{Binding Children}"/>
        <Setter Property="Command" Value="{Binding Command}" />
        <Style.Triggers>
            <DataTrigger Binding="{Binding Text}" Value="{x:Null}">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="MenuItem">
                            <Separator />
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </DataTrigger>
        </Style.Triggers>
    </Style>
    
    <DataTemplate x:Key="RangeStructureElementPropertiesTemplate" DataType="{x:Type Visuals:RangeStructureElementVisualComponent}">
        <Grid Margin="2">
            <Grid.RowDefinitions>
                <RowDefinition></RowDefinition>
                <RowDefinition></RowDefinition>
                <RowDefinition></RowDefinition>
                <RowDefinition></RowDefinition>
                <RowDefinition></RowDefinition>
                <RowDefinition></RowDefinition>
            </Grid.RowDefinitions>
            
            <Grid.ColumnDefinitions>
                <ColumnDefinition></ColumnDefinition>
                <ColumnDefinition Width="1"></ColumnDefinition>
                <ColumnDefinition></ColumnDefinition>
            </Grid.ColumnDefinitions>

            <Rectangle Grid.Column="1"
                       Grid.RowSpan="6"
                       HorizontalAlignment="Stretch"
                       VerticalAlignment="Stretch"
                       Fill="White">
            </Rectangle>

            <TextBlock Text="Size"
                       HorizontalAlignment="Left"
                       Grid.Column="0"
                       Grid.Row="0"></TextBlock>
            <TextBlock HorizontalAlignment="Center"
                       Grid.Column="2"
                       Grid.Row="0">
                <TextBlock.Style>
                    <Style BasedOn="{StaticResource {x:Type TextBlock}}"
                           TargetType="{x:Type TextBlock}">
                        <Setter Property="Text" Value="{Binding Path=RangeSize}"></Setter>
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding Path=RangeSize}" Value="0">
                                <Setter Property="Text" Value=""></Setter>
                            </DataTrigger>
                        </Style.Triggers>        
                    </Style>
                </TextBlock.Style>
            </TextBlock>
            
            <TextBlock Text="Start"
                       HorizontalAlignment="Left"
                       Grid.Column="0"
                       Grid.Row="1"></TextBlock>
            <TextBlock HorizontalAlignment="Center"
                       Grid.Column="2"
                       Grid.Row="1">
                <TextBlock.Style>
                    <Style BasedOn="{StaticResource {x:Type TextBlock}}"
                           TargetType="{x:Type TextBlock}">
                        <Setter Property="Text" Value="{Binding Path=StartNucleotideIndex, Converter={julmar:MathConverter Operation=+1}}"></Setter>
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding Path=StartNucleotideIndex}" Value="-1">
                                <Setter Property="Text" Value=""></Setter>
                            </DataTrigger>
                        </Style.Triggers>        
                    </Style>
                </TextBlock.Style>
            </TextBlock>

            <TextBlock Text="End"
                       HorizontalAlignment="Left"
                       Grid.Column="0"
                       Grid.Row="2"></TextBlock>
            <TextBlock HorizontalAlignment="Center"
                       Grid.Column="2"
                       Grid.Row="2">
                <TextBlock.Style>
                    <Style BasedOn="{StaticResource {x:Type TextBlock}}"
                           TargetType="{x:Type TextBlock}">
                        <Setter Property="Text" Value="{Binding Path=EndNucleotideIndex, Converter={julmar:MathConverter Operation=+1}}"></Setter>
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding Path=EndNucleotideIndex}" Value="-1">
                                <Setter Property="Text" Value=""></Setter>
                            </DataTrigger>
                        </Style.Triggers>        
                    </Style>
                </TextBlock.Style>
            </TextBlock>

            <TextBlock Text="Select Only Nt"
                       HorizontalAlignment="Left"
                       Grid.Column="0"
                       Grid.Row="3"></TextBlock>
            <CheckBox HorizontalAlignment="Center"
                      HorizontalContentAlignment="Center"
                      VerticalContentAlignment="Center"
                      Grid.Column="2"
                      Grid.Row="3"
                      Margin="5,0,0,0"
                      IsChecked="{Binding Path=ProcessSelectionRangeAsNucleotides, Mode=TwoWay}">
                <CheckBox.ToolTip>
                    <TextBlock Text="If on, select all Structure Elements in range as Nucleotides"></TextBlock>
                </CheckBox.ToolTip>
            </CheckBox>
            
            <TextBlock Text="Limit Selection to Pairs"
                       HorizontalAlignment="Left"
                       Grid.Column="0"
                       Grid.Row="4"></TextBlock>
            <CheckBox HorizontalAlignment="Center"
                      HorizontalContentAlignment="Center"
                      VerticalContentAlignment="Center"
                      Grid.Column="2"
                      Grid.Row="4"
                      Margin="5,0,0,0"
                      IsChecked="{Binding Path=LimitSelectionToBasePairs, Mode=TwoWay}">
                <CheckBox.ToolTip>
                    <TextBlock Text="Only select Base Pairs in the range"></TextBlock>
                </CheckBox.ToolTip>
            </CheckBox>

            <TextBlock Text="Limit Selection to Nt"
                       HorizontalAlignment="Left"
                       Grid.Column="0"
                       Grid.Row="5"></TextBlock>
            <CheckBox HorizontalAlignment="Center"
                      HorizontalContentAlignment="Center"
                      VerticalContentAlignment="Center"
                      Grid.Column="2"
                      Grid.Row="5"
                      Margin="5,0,0,0"
                      IsChecked="{Binding Path=LimitSelectionToNucleotides, Mode=TwoWay}">
                <CheckBox.ToolTip>
                    <TextBlock Text="Only select unpaired Nucleotides in the range"></TextBlock>
                </CheckBox.ToolTip>
            </CheckBox>
        </Grid>
    </DataTemplate>
    
    <DataTemplate x:Key="LoopStructureElementPropertiesTemplate" DataType="{x:Type Visuals:LoopStructureElementVisualComponent}">
        <Grid Margin="2">
            <Grid.RowDefinitions>
                <RowDefinition></RowDefinition>
                <RowDefinition></RowDefinition>
                <RowDefinition></RowDefinition>
                <RowDefinition></RowDefinition>
            </Grid.RowDefinitions>
            
            <Grid.ColumnDefinitions>
                <ColumnDefinition></ColumnDefinition>
                <ColumnDefinition Width="1"></ColumnDefinition>
                <ColumnDefinition></ColumnDefinition>
            </Grid.ColumnDefinitions>

            <Rectangle Grid.Column="1"
                       Grid.RowSpan="4"
                       HorizontalAlignment="Stretch"
                       VerticalAlignment="Stretch"
                       Fill="White">
            </Rectangle>

            <TextBlock Text="Length"
                       HorizontalAlignment="Left"
                       Grid.Column="0"
                       Grid.Row="0"></TextBlock>
            <TextBlock Text="{Binding Path=Strand.Count}"
                       HorizontalAlignment="Center"
                       Grid.Column="2"
                       Grid.Row="0"></TextBlock>
            
            <TextBlock Text="Type"
                       HorizontalAlignment="Left"
                       Grid.Column="0"
                       Grid.Row="1"></TextBlock>
            <TextBlock Text="{Binding Path=StrandType}"
                       HorizontalAlignment="Center"
                       Grid.Column="2"
                       Grid.Row="1"></TextBlock>

            <TextBlock Text="Start"
                       HorizontalAlignment="Left"
                       Grid.Column="0"
                       Grid.Row="2"></TextBlock>
            <TextBlock Text="{Binding Path=StartNucleotideIndex, Converter={julmar:MathConverter Operation=+1}}"
                       HorizontalAlignment="Center"
                       Grid.Column="2"
                       Grid.Row="2"></TextBlock>
            
            <TextBlock Text="End"
                       HorizontalAlignment="Left"
                       Grid.Column="0"
                       Grid.Row="3"></TextBlock>
            <TextBlock Text="{Binding Path=EndNucleotideIndex, Converter={julmar:MathConverter Operation=+1}}"
                       HorizontalAlignment="Center"
                       Grid.Column="2"
                       Grid.Row="3"></TextBlock>
        </Grid>
        
    </DataTemplate>
    
    <DataTemplate x:Key="HelixStructureElementPropertiesTemplate">
        <Grid Margin="2">
            <Grid.RowDefinitions>
                <RowDefinition></RowDefinition>
                <RowDefinition></RowDefinition>
                <RowDefinition></RowDefinition>
                <RowDefinition></RowDefinition>
                <RowDefinition></RowDefinition>
                <RowDefinition></RowDefinition>
            </Grid.RowDefinitions>
            
            <Grid.ColumnDefinitions>
                <ColumnDefinition></ColumnDefinition>
                <ColumnDefinition Width="1"></ColumnDefinition>
                <ColumnDefinition></ColumnDefinition>
            </Grid.ColumnDefinitions>

            <Rectangle Grid.Column="1"
                       Grid.RowSpan="6"
                       HorizontalAlignment="Stretch"
                       VerticalAlignment="Stretch"
                       Fill="White">
            </Rectangle>
            
            <TextBlock Text="Base Pairs"
                       HorizontalAlignment="Left"
                       Grid.Column="0"
                       Grid.Row="0"></TextBlock>
            <TextBlock Text="{Binding Path=BasePairs.Count}"
                       HorizontalAlignment="Center"
                       Grid.Column="2"
                       Grid.Row="0"></TextBlock>

            <TextBlock Text="Pseudoknotted"
                       HorizontalAlignment="Left"
                       Grid.Column="0"
                       Grid.Row="1"></TextBlock>
            <CheckBox HorizontalAlignment="Center"
                      HorizontalContentAlignment="Center"
                      VerticalContentAlignment="Center"
                      Grid.Column="2"
                      Grid.Row="1"
                      IsEnabled="False"
                      Margin="5,0,0,0"
                      IsChecked="{Binding Path=IsPseudoknotted, Mode=OneWay}"></CheckBox>

            <TextBlock Text="5' Start Index"
                       HorizontalAlignment="Left"
                       Grid.Column="0"
                       Grid.Row="2"></TextBlock>
            <TextBlock Text="{Binding Path=FivePrimeStartNucleotideIndex, Converter={julmar:MathConverter Operation=+1}}"
                       HorizontalAlignment="Center"
                       Grid.Column="2"
                       Grid.Row="2"></TextBlock>

            <TextBlock Text="5' End Index"
                       HorizontalAlignment="Left"
                       Grid.Column="0"
                       Grid.Row="3"></TextBlock>
            <TextBlock Text="{Binding Path=FivePrimeEndNucleotideIndex, Converter={julmar:MathConverter Operation=+1}}"
                       HorizontalAlignment="Center"
                       Grid.Column="2"
                       Grid.Row="3"></TextBlock>

            <TextBlock Text="3' Start Index"
                       HorizontalAlignment="Left"
                       Grid.Column="0"
                       Grid.Row="4"></TextBlock>
            <TextBlock Text="{Binding Path=ThreePrimeStartNucleotideIndex, Converter={julmar:MathConverter Operation=+1}}"
                       HorizontalAlignment="Center"
                       Grid.Column="2"
                       Grid.Row="4"></TextBlock>

            <TextBlock Text="3' End Index"
                       HorizontalAlignment="Left"
                       Grid.Column="0"
                       Grid.Row="5"></TextBlock>
            <TextBlock Text="{Binding Path=ThreePrimeEndNucleotideIndex, Converter={julmar:MathConverter Operation=+1}}"
                       HorizontalAlignment="Center"
                       Grid.Column="2"
                       Grid.Row="5"></TextBlock>
        </Grid>
    </DataTemplate>
    
    <DataTemplate x:Key="BasePairStructureElementPropertiesTemplate" DataType="{x:Type Visuals:BasePairStructureElementVisualComponent}">
        <Grid Margin="2">
            <Grid.RowDefinitions>
                <RowDefinition></RowDefinition>
                <RowDefinition></RowDefinition>
                <RowDefinition></RowDefinition>
                <RowDefinition></RowDefinition>
                <RowDefinition></RowDefinition>
            </Grid.RowDefinitions>

            <Grid.ColumnDefinitions>
                <ColumnDefinition></ColumnDefinition>
                <ColumnDefinition Width="1"></ColumnDefinition>
                <ColumnDefinition></ColumnDefinition>
            </Grid.ColumnDefinitions>

            <Rectangle Grid.Column="1"
                       Grid.RowSpan="5"
                       HorizontalAlignment="Stretch"
                       VerticalAlignment="Stretch"
                       Fill="White">
            </Rectangle>
            
            <TextBlock Text="5' Index"
                       HorizontalAlignment="Left"
                       Grid.Column="0"
                       Grid.Row="0"></TextBlock>
            <TextBlock Text="{Binding Path=Data.FivePrimeIndex, Converter={julmar:MathConverter Operation=+1}}"
                       HorizontalAlignment="Center"
                       Grid.Column="2"
                       Grid.Row="0"></TextBlock>

            <TextBlock Text="3' Index"
                       HorizontalAlignment="Left"
                       Grid.Column="0"
                       Grid.Row="1"></TextBlock>
            <TextBlock Text="{Binding Path=Data.ThreePrimeIndex, Converter={julmar:MathConverter Operation=+1}}"
                       HorizontalAlignment="Center"
                       Grid.Column="2"
                       Grid.Row="1"></TextBlock>

            <TextBlock Text="Base Pair"
                       HorizontalAlignment="Left"
                       Grid.Column="0"
                       Grid.Row="2"></TextBlock>
            <TextBlock Grid.Column="2"
                       Grid.Row="2"
                       HorizontalAlignment="Center"
                       Text="{Binding Path=Data.Text}">
            </TextBlock>
            
            <TextBlock Text="Angle"
                       HorizontalAlignment="Left"
                       Grid.Column="0"
                       Grid.Row="3"></TextBlock>
            <TextBlock Grid.Column="2"
                       Grid.Row="3"
                       HorizontalAlignment="Center"
                       Text="{Binding Path=RayAngle, Mode=OneWay, Converter={Converters:RadiansToDegreesConverter}, StringFormat=f}"></TextBlock>
            <TextBlock Text="Distance"
                       HorizontalAlignment="Left"
                       Grid.Column="0"
                       Grid.Row="4"></TextBlock>
            <TextBlock Grid.Column="2"
                       Grid.Row="4"
                       HorizontalAlignment="Center"
                       Text="{Binding Path=Magnitude, Mode=OneWay, StringFormat=f}"></TextBlock>
        </Grid>
    </DataTemplate>

    <DataTemplate x:Key="BasePairConnectorElementRenderingPropertiesEditableTemplate">
        <Grid Margin="2">
            <Grid.RowDefinitions>
                <RowDefinition></RowDefinition>
                <RowDefinition></RowDefinition>
                <RowDefinition></RowDefinition>
                <RowDefinition></RowDefinition>
                <RowDefinition></RowDefinition>
                <RowDefinition></RowDefinition>
                <RowDefinition></RowDefinition>
            </Grid.RowDefinitions>

            <Grid.ColumnDefinitions>
                <ColumnDefinition></ColumnDefinition>
                <ColumnDefinition Width="1"></ColumnDefinition>
                <ColumnDefinition></ColumnDefinition>
            </Grid.ColumnDefinitions>
            
            <Rectangle Grid.Column="1"
                       Grid.Row="0"
                       Grid.RowSpan="7"
                       HorizontalAlignment="Stretch"
                       VerticalAlignment="Stretch"
                       Fill="White">
            </Rectangle>

            <TextBlock Text="Visible"
                       HorizontalAlignment="Left"
                       VerticalAlignment="Center"
                       Grid.Column="0"
                       Grid.Row="0"></TextBlock>
            <Border Grid.Column="2"
                    Grid.Row="0"
                    Padding="2"
                    HorizontalAlignment="Stretch"
                    VerticalAlignment="Center"
                    Margin="25,0,25,0">
                <ComboBox FontSize="10"
                          IsEditable="True"
                          IsReadOnly="True"
                          SelectedValue="{Binding Path=BasePairConnectorIsVisible, Converter={Converters:InheritingBasePairConnectorIsVisibleToStringConverter}}"
                          SelectedValuePath="Tag">
                    <ComboBoxItem Tag="Visible">Visible</ComboBoxItem>
                    <ComboBoxItem Tag="Hidden">Hidden</ComboBoxItem>
                    <ComboBoxItem Tag="Inherited">Inheriting</ComboBoxItem>
                </ComboBox>
            </Border>
            
            
            <TextBlock Text="Style"
                       HorizontalAlignment="Left"
                       VerticalAlignment="Center"
                       Grid.Column="0"
                       Grid.Row="1"></TextBlock>
            <Border HorizontalAlignment="Stretch"
                    VerticalAlignment="Center"
                    Margin="25,0,25,0"
                    Grid.Row="1"
                    Grid.Column="2"
                    Padding="2">
                <ComboBox FontSize="10"
                      Padding="5"
                      IsEditable="True"
                      IsReadOnly="True"
                      SelectedValue="{Binding Path=BasePairConnectorRenderingStyle, Converter={Converters:InheritingBasePairConnectorRenderingModeToStringConverter}}"
                      SelectedValuePath="Tag">
                    <ComboBoxItem Tag="Line">Line</ComboBoxItem>
                    <ComboBoxItem Tag="Circle">Circle</ComboBoxItem>
                    <ComboBoxItem Tag="Rectangle">Rectangle</ComboBoxItem>
                    <ComboBoxItem Tag="Inherited">Inheriting</ComboBoxItem>
                </ComboBox>
            </Border>

            <TextBlock Text="Stroke"
                       HorizontalAlignment="Left"
                       VerticalAlignment="Center"
                       Grid.Column="0"
                       Grid.Row="2"></TextBlock>
            <Border Grid.Column="2"
                    Grid.Row="2"
                    Padding="2"
                    HorizontalAlignment="Stretch"
                    VerticalAlignment="Stretch"
                    Height="20"
                    Margin="35,0,35,0">
                <Rectangle Fill="{Binding Path=BasePairConnectorStroke, Converter={Converters:NullBrushToTransparentConverter}}"
                           Stroke="{Binding Path=BasePairConnectorStroke, Converter={Converters:InheritingBrushConverter}}">
                    <Interactivity:Interaction.Triggers>
                        <Interactivity:EventTrigger EventName="MouseLeftButtonDown">
                            <julmar:InvokeCommand Command="{x:Static SECommands:StructureEditorCommands.ChangeBasePairConnectorStroke}"
                                                  CommandParameter="{Binding}">
                            </julmar:InvokeCommand>
                        </Interactivity:EventTrigger>
                    </Interactivity:Interaction.Triggers>
                </Rectangle>
            </Border>
            
            <TextBlock Text="Thickness"
                       HorizontalAlignment="Left"
                       VerticalAlignment="Center"
                       Grid.Column="0"
                       Grid.Row="3"></TextBlock>
            <Border Grid.Row="3"
                    Grid.Column="2"
                    Padding="2"
                    HorizontalAlignment="Stretch"
                    VerticalAlignment="Center"
                    Margin="25,2,25,2">
                <TextBox FontSize="10"
                         Text="{Binding Path=BasePairConnectorStrokeThickness, Converter={Converters:NullDoubleToDoubleConverter}}">
                    <Interactivity:Interaction.Behaviors>
                        <SEBehaviors:InheritingNumericTextBoxBehavior />
                    </Interactivity:Interaction.Behaviors>
                </TextBox>
                <Border.ToolTip>
                    <TextBlock Text="Entering a negative value triggers Inheriting mode"></TextBlock>
                </Border.ToolTip>
            </Border>

            <TextBlock Text="Size"
                       HorizontalAlignment="Left"
                       VerticalAlignment="Center"
                       Grid.Column="0"
                       Grid.Row="4"></TextBlock>
            <Border Grid.Row="4"
                    Grid.Column="2"
                    Padding="2"
                    HorizontalAlignment="Stretch"
                    VerticalAlignment="Center"
                    Margin="25,2,25,2">
                <TextBox FontSize="10"
                         Text="{Binding Path=BasePairConnectorSize, Converter={Converters:NullDoubleToDoubleConverter}}">
                    <Interactivity:Interaction.Behaviors>
                        <SEBehaviors:InheritingNumericTextBoxBehavior />
                    </Interactivity:Interaction.Behaviors>
                </TextBox>
                <Border.ToolTip>
                    <TextBlock Text="Entering a negative value triggers Inheriting mode"></TextBlock>
                </Border.ToolTip>
            </Border>

            <TextBlock Text="Fill"
                       HorizontalAlignment="Left"
                       VerticalAlignment="Center"
                       Grid.Column="0"
                       Grid.Row="5"></TextBlock>
            <Border Grid.Column="2"
                    Grid.Row="5"
                    Padding="2"
                    HorizontalAlignment="Stretch"
                    VerticalAlignment="Stretch"
                    Height="20"
                    Margin="35,0,35,0">
                <Rectangle Fill="{Binding Path=BasePairConnectorFill, Converter={Converters:NullBrushToTransparentConverter}}"
                           Stroke="{Binding Path=BasePairConnectorFill, Converter={Converters:InheritingBrushConverter}}">
                    <Interactivity:Interaction.Triggers>
                        <Interactivity:EventTrigger EventName="MouseLeftButtonDown">
                            <julmar:InvokeCommand Command="{x:Static SECommands:StructureEditorCommands.ChangeBasePairConnectorFill}"
                                                  CommandParameter="{Binding}">
                            </julmar:InvokeCommand>
                        </Interactivity:EventTrigger>
                    </Interactivity:Interaction.Triggers>
                </Rectangle>
            </Border>
            
            <TextBlock Text="Filled"
                       HorizontalAlignment="Left"
                       VerticalAlignment="Center"
                       Grid.Column="0"
                       Grid.Row="6"></TextBlock>
            <Border Grid.Column="2"
                    Grid.Row="6"
                    Padding="2"
                    HorizontalAlignment="Stretch"
                    VerticalAlignment="Center"
                    Margin="25,0,25,0">
                <ComboBox FontSize="10"
                          IsEditable="True"
                          IsReadOnly="True"
                          SelectedValue="{Binding Path=BasePairConnectorIsFilled, Converter={Converters:InheritingIsFilledToStringConverter}}"
                          SelectedValuePath="Tag">
                    <ComboBoxItem Tag="Filled">Filled</ComboBoxItem>
                    <ComboBoxItem Tag="NotFilled">Not Filled</ComboBoxItem>
                    <ComboBoxItem Tag="Inherited">Inheriting</ComboBoxItem>
                </ComboBox>
            </Border>
        </Grid>
    </DataTemplate>

    <DataTemplate x:Key="NucleotideStructureElementRenderingPropertiesEditableTemplate">
        <Grid Margin="2">
            <Grid.RowDefinitions>
                <RowDefinition></RowDefinition>
                <RowDefinition></RowDefinition>
                <RowDefinition></RowDefinition>
                <RowDefinition></RowDefinition>
                <RowDefinition></RowDefinition>
                <RowDefinition></RowDefinition>
                <RowDefinition></RowDefinition>
                <RowDefinition></RowDefinition>
                <RowDefinition></RowDefinition>
                <RowDefinition></RowDefinition>
                <RowDefinition></RowDefinition>
                <RowDefinition></RowDefinition>
                <RowDefinition></RowDefinition>
            </Grid.RowDefinitions>
            
            <Grid.ColumnDefinitions>
                <ColumnDefinition></ColumnDefinition>
                <ColumnDefinition Width="1"></ColumnDefinition>
                <ColumnDefinition></ColumnDefinition>
            </Grid.ColumnDefinitions>

            <Rectangle Grid.Column="1"
                       Grid.Row="0"
                       Grid.RowSpan="1"
                       HorizontalAlignment="Stretch"
                       VerticalAlignment="Stretch"
                       Fill="White">
            </Rectangle>

            <TextBlock Text="Shape"
                       Grid.Column="0"
                       Grid.Row="0"
                       HorizontalAlignment="Left"
                       VerticalAlignment="Center"></TextBlock>
            <Border HorizontalAlignment="Stretch"
                    VerticalAlignment="Center"
                    Margin="25,0,25,0"
                    Grid.Row="0"
                    Grid.Column="2"
                    Padding="2">
                <ComboBox FontSize="10"
                      Padding="5"
                      IsEditable="True"
                      IsReadOnly="True"
                      SelectedValue="{Binding Path=NucleotideRenderingStyle, Converter={Converters:InheritingNucleotideRenderingModeToStringConverter}}"
                      SelectedValuePath="Tag">
                    <ComboBoxItem Tag="Text">Text</ComboBoxItem>
                    <ComboBoxItem Tag="Circle">Circle</ComboBoxItem>
                    <ComboBoxItem Tag="Inherited">Inheriting</ComboBoxItem>
                </ComboBox>
            </Border>
            
            <Grid Grid.Row="1"
                  Grid.ColumnSpan="3">
                <TextBlock HorizontalAlignment="Left"
                           Text="Text Shape Properties"
                           FontWeight="Bold"
                           TextDecorations="Underline">
                </TextBlock>
            </Grid>

            <Rectangle Grid.Column="1"
                       Grid.Row="2"
                       Grid.RowSpan="5"
                       HorizontalAlignment="Stretch"
                       VerticalAlignment="Stretch"
                       Fill="White">
            </Rectangle>

            <TextBlock Text="Font"
                       Grid.Column="0"
                       Grid.Row="2"
                       TextWrapping="Wrap"
                       HorizontalAlignment="Left"
                       VerticalAlignment="Center"></TextBlock>
            <Border Grid.Row="2"
                    Grid.Column="2"
                    Padding="2"
                    HorizontalAlignment="Stretch"
                    VerticalAlignment="Center"
                    Margin="25,0,25,0"
                    BorderBrush="{x:Null}"
                    x:Name="NucleotideFontFamilySelector">
                <ComboBox FontSize="10"
                          IsEditable="True"
                          IsReadOnly="True"
                          SelectedValue="{Binding Path=NucleotideFontFamily, Converter={Converters:InheritingNucleotideFontFamilyToStringConverter}}"
                          SelectedValuePath="Tag">
                    <ComboBoxItem Tag="Arial">Arial</ComboBoxItem>
                    <ComboBoxItem Tag="Times">Times</ComboBoxItem>
                    <ComboBoxItem Tag="Times New Roman">Times New Roman</ComboBoxItem>
                    <ComboBoxItem Tag="Courier">Courier</ComboBoxItem>
                    <ComboBoxItem Tag="Courier New">Courier New</ComboBoxItem>
                    <ComboBoxItem Tag="Symbol">Symbol</ComboBoxItem>
                    <ComboBoxItem Tag="Inherited">Inheriting</ComboBoxItem>
                </ComboBox>
            </Border>

            <TextBlock Text="Style"
                       Grid.Column="0"
                       Grid.Row="3"
                       HorizontalAlignment="Left"
                       VerticalAlignment="Center"></TextBlock>
            <Border Grid.Row="3"
                    Grid.Column="2"
                    Padding="2"
                    HorizontalAlignment="Stretch"
                    VerticalAlignment="Center"
                    Margin="25,0,25,0">
                <ComboBox FontSize="10"
                          IsEditable="True"
                          IsReadOnly="True"
                          SelectedValue="{Binding Path=NucleotideFontStyle, Converter={Converters:InheritingNucleotideFontStyleToStringConverter}}"
                          SelectedValuePath="Tag">
                    <ComboBoxItem Tag="Normal">Normal</ComboBoxItem>
                    <ComboBoxItem Tag="Oblique">Oblique</ComboBoxItem>
                    <ComboBoxItem Tag="Italic">Italic</ComboBoxItem>
                    <ComboBoxItem Tag="Inherited">Inheriting</ComboBoxItem>
                </ComboBox>      
            </Border>

            <TextBlock Text="Weight"
                       Grid.Column="0"
                       Grid.Row="4"
                       HorizontalAlignment="Left"
                       VerticalAlignment="Center"></TextBlock>
            <Border Grid.Row="4"
                    Grid.Column="2"
                    Padding="2"
                    HorizontalAlignment="Stretch"
                    VerticalAlignment="Center"
                    Margin="25,0,25,0">
                <ComboBox FontSize="10"
                          IsEditable="True"
                          IsReadOnly="True"
                          SelectedValue="{Binding Path=NucleotideFontWeight, Converter={Converters:InheritingNucleotideFontWeightToStringConverter}}"
                          SelectedValuePath="Tag">
                    <ComboBoxItem Tag="Normal">Regular</ComboBoxItem>
                    <ComboBoxItem Tag="Bold">Bold</ComboBoxItem>
                    <ComboBoxItem Tag="Inherited">Inheriting</ComboBoxItem>
                </ComboBox>
            </Border>

            <TextBlock Text="Size"
                       Grid.Column="0"
                       Grid.Row="5"
                       HorizontalAlignment="Left"></TextBlock>
            <Border Grid.Row="5"
                    Grid.Column="2"
                    Padding="2"
                    HorizontalAlignment="Stretch"
                    VerticalAlignment="Center"
                    Margin="25,0,25,0">
                <ComboBox FontSize="10"
                          IsEditable="True"
                          IsReadOnly="True"
                          SelectedItem="{Binding Path=NucleotideFontSize, Converter={Converters:NullDoubleToDoubleConverter}}"
                          ItemsSource="{StaticResource ValidNucleotideFontSizes}">
                    <ComboBox.ItemTemplate>
                        <DataTemplate>
                            <TextBlock Name="cbNucleotideFontSizeSelectionList" Text="{Binding}" />
                            <DataTemplate.Triggers>
                                <DataTrigger Binding="{Binding}" Value="-1.0">
                                    <Setter TargetName="cbNucleotideFontSizeSelectionList" Property="Text" Value="Inheriting" />
                                </DataTrigger>
                            </DataTemplate.Triggers>
                        </DataTemplate>
                    </ComboBox.ItemTemplate>
                </ComboBox>
            </Border>
                       
            <TextBlock Text="Fill"
                       Grid.Column="0"
                       Grid.Row="6"
                       HorizontalAlignment="Left"></TextBlock>
            <Border Grid.Column="2"
                    Grid.Row="6"
                    Padding="2"
                    HorizontalAlignment="Stretch"
                    VerticalAlignment="Stretch"
                    Height="20"
                    Margin="35,0,35,0">
                <Rectangle Fill="{Binding Path=NucleotideFill, Converter={Converters:NullBrushToTransparentConverter}}"
                           Stroke="{Binding Path=NucleotideFill, Converter={Converters:InheritingBrushConverter}}">
                    <Interactivity:Interaction.Triggers>
                        <Interactivity:EventTrigger EventName="MouseLeftButtonDown">
                            <julmar:InvokeCommand Command="{x:Static SECommands:StructureEditorCommands.ChangeNucleotideFill}"
                                                  CommandParameter="{Binding}">
                            </julmar:InvokeCommand>
                        </Interactivity:EventTrigger>
                    </Interactivity:Interaction.Triggers>
                </Rectangle>
            </Border>

            <Grid Grid.Row="7"
                  Grid.ColumnSpan="3">
                <TextBlock HorizontalAlignment="Left"
                           Text="Circle Shape Properties"
                           FontWeight="Bold"
                           TextDecorations="Underline">
                </TextBlock>
            </Grid>

            <Rectangle Grid.Column="1"
                       Grid.Row="8"
                       Grid.RowSpan="5"
                       HorizontalAlignment="Stretch"
                       VerticalAlignment="Stretch"
                       Fill="White">
            </Rectangle>

            <TextBlock Text="Filled"
                       Grid.Column="0"
                       Grid.Row="8"
                       HorizontalAlignment="Left"
                       VerticalAlignment="Center"></TextBlock>
            <Border Grid.Column="2"
                    Grid.Row="8"
                    Padding="2"
                    HorizontalAlignment="Stretch"
                    VerticalAlignment="Center"
                    Margin="25,0,25,0">
                <ComboBox FontSize="10"
                          IsEditable="True"
                          IsReadOnly="True"
                          SelectedValue="{Binding Path=NucleotideCircleIsFilled, Converter={Converters:InheritingIsFilledToStringConverter}}"
                          SelectedValuePath="Tag">
                    <ComboBoxItem Tag="Filled">Filled</ComboBoxItem>
                    <ComboBoxItem Tag="NotFilled">Not Filled</ComboBoxItem>
                    <ComboBoxItem Tag="Inherited">Inheriting</ComboBoxItem>
                </ComboBox>
            </Border>

            <TextBlock Text="Diameter"
                       Grid.Column="0"
                       Grid.Row="9"
                       HorizontalAlignment="Left"
                       VerticalAlignment="Center"></TextBlock>
            <Border Grid.Row="9"
                    Grid.Column="2"
                    Padding="2"
                    HorizontalAlignment="Stretch"
                    VerticalAlignment="Center"
                    Margin="25,2,25,2">
                <TextBox FontSize="10"
                         Text="{Binding Path=NucleotideCircleDiameter, Converter={Converters:NullDoubleToDoubleConverter}}">
                    <Interactivity:Interaction.Behaviors>
                        <SEBehaviors:InheritingNumericTextBoxBehavior />
                    </Interactivity:Interaction.Behaviors>
                </TextBox>
                <Border.ToolTip>
                    <TextBlock Text="Entering a negative value triggers Inheriting mode"></TextBlock>
                </Border.ToolTip>
            </Border>

            <TextBlock Text="Edge Thickness"
                       Grid.Column="0"
                       Grid.Row="10"
                       HorizontalAlignment="Left"
                       VerticalAlignment="Center"></TextBlock>
            <Border Grid.Row="10"
                    Grid.Column="2"
                    Padding="2"
                    HorizontalAlignment="Stretch"
                    VerticalAlignment="Center"
                    Margin="25,2,25,2">
                <TextBox FontSize="10"
                         Text="{Binding Path=NucleotideCircleEdgeThickness, Converter={Converters:NullDoubleToDoubleConverter}}">
                    <Interactivity:Interaction.Behaviors>
                        <SEBehaviors:InheritingNumericTextBoxBehavior />
                    </Interactivity:Interaction.Behaviors>
                </TextBox>
                <Border.ToolTip>
                    <TextBlock Text="Entering a negative value triggers Inheriting mode"></TextBlock>
                </Border.ToolTip>
            </Border>
            
            <TextBlock Text="Fill"
                       Grid.Column="0"
                       Grid.Row="11"
                       HorizontalAlignment="Left"
                       VerticalAlignment="Center"></TextBlock>
            <Border Grid.Column="2"
                    Grid.Row="11"
                    Padding="2"
                    HorizontalAlignment="Stretch"
                    VerticalAlignment="Stretch"
                    Height="20"
                    Margin="35,0,35,0">
                <Rectangle Fill="{Binding Path=NucleotideCircleFill, Converter={Converters:NullBrushToTransparentConverter}}"
                           Stroke="{Binding Path=NucleotideCircleFill, Converter={Converters:InheritingBrushConverter}}">
                    <Interactivity:Interaction.Triggers>
                        <Interactivity:EventTrigger EventName="MouseLeftButtonDown">
                            <julmar:InvokeCommand Command="{x:Static SECommands:StructureEditorCommands.ChangeNucleotideCircleFill}"
                                                  CommandParameter="{Binding}">
                            </julmar:InvokeCommand>
                        </Interactivity:EventTrigger>
                    </Interactivity:Interaction.Triggers>
                </Rectangle>
            </Border>

            <TextBlock Text="Stroke"
                       Grid.Column="0"
                       Grid.Row="12"
                       HorizontalAlignment="Left"
                       VerticalAlignment="Center"></TextBlock>
            <Border Grid.Column="2"
                    Grid.Row="12"
                    Padding="2"
                    HorizontalAlignment="Stretch"
                    VerticalAlignment="Stretch"
                    Height="20"
                    Margin="35,0,35,0">
                <Rectangle Fill="{Binding Path=NucleotideCircleStroke, Converter={Converters:NullBrushToTransparentConverter}}"
                           Stroke="{Binding Path=NucleotideCircleStroke, Converter={Converters:InheritingBrushConverter}}">
                    <Interactivity:Interaction.Triggers>
                        <Interactivity:EventTrigger EventName="MouseLeftButtonDown">
                            <julmar:InvokeCommand Command="{x:Static SECommands:StructureEditorCommands.ChangeNucleotideCircleStroke}"
                                                  CommandParameter="{Binding}">
                            </julmar:InvokeCommand>
                        </Interactivity:EventTrigger>
                    </Interactivity:Interaction.Triggers>
                </Rectangle>
            </Border>
        </Grid>
    </DataTemplate>
    
    <DataTemplate x:Key="NucleotideStructureElementPropertiesTemplate">
        <Grid Margin="2">
            <Grid.RowDefinitions>
                <RowDefinition></RowDefinition>
                <RowDefinition></RowDefinition>
                <RowDefinition></RowDefinition>
                <RowDefinition></RowDefinition>
            </Grid.RowDefinitions>

            <Grid.ColumnDefinitions>
                <ColumnDefinition></ColumnDefinition>
                <ColumnDefinition Width="1"></ColumnDefinition>
                <ColumnDefinition></ColumnDefinition>
            </Grid.ColumnDefinitions>

            <Rectangle Grid.Column="1"
                       Grid.RowSpan="4"
                       HorizontalAlignment="Stretch"
                       VerticalAlignment="Stretch"
                       Fill="White">
            </Rectangle>

            <TextBlock Text="Index"
                       Grid.Column="0"
                       Grid.Row="0"
                       HorizontalAlignment="Left">
            </TextBlock>
            <TextBlock Grid.Column="2"
                       Grid.Row="0"
                       HorizontalAlignment="Center"
                       Text="{Binding Path=NucleotideIndex, Converter={julmar:MathConverter Operation=+1}}"></TextBlock>

            <TextBlock Text="Nucleotide"
                       Grid.Column="0"
                       Grid.Row="1"
                       HorizontalAlignment="Left">
            </TextBlock>
            <TextBlock Grid.Column="2"
                       Grid.Row="1"
                       HorizontalAlignment="Center"
                       Text="{Binding Path=Data.Text}">
            </TextBlock>

            <TextBlock Text="Location"
                       Grid.Column="0"
                       Grid.Row="2"
                       HorizontalAlignment="Left">
            </TextBlock>
            <TextBlock Grid.Column="2"
                       Grid.Row="2"
                       HorizontalAlignment="Center">
                    <TextBlock.Text>
                        <MultiBinding StringFormat="{}{0:f} x {1:f}">
                            <Binding Path="Location.X"></Binding>
                            <Binding Path="Location.Y"></Binding>
                        </MultiBinding>
                    </TextBlock.Text>
            </TextBlock>

            <TextBlock Text="Size"
                       HorizontalAlignment="Left"
                       Grid.Column="0"
                       Grid.Row="3"></TextBlock>
            <TextBlock Grid.Column="2"
                       Grid.Row="3"
                       HorizontalAlignment="Center">
                    <TextBlock.Text>
                        <MultiBinding StringFormat="{}{0:f} x {1:f}">
                            <Binding Path="RenderedSize.Width"></Binding>
                            <Binding Path="RenderedSize.Height"></Binding>
                        </MultiBinding>
                    </TextBlock.Text>
            </TextBlock>
        </Grid>
    </DataTemplate>
    
    <DataTemplate x:Key="BasePairConnectorGlobalRenderingOptionsTemplate" DataType="{x:Type ViewModels:BasePairVisualRenderingOptionsViewModel}">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="40"></RowDefinition>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="40"></RowDefinition>
            </Grid.RowDefinitions>
            
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="0.3*"></ColumnDefinition>
                <ColumnDefinition></ColumnDefinition>
            </Grid.ColumnDefinitions>

            <Label Grid.Column="0"
                   Grid.Row="0"
                   VerticalAlignment="Center"
                   HorizontalAlignment="Left"
                   Margin="5,0,0,0">
                <TextBlock TextWrapping="Wrap">Rendering Style:</TextBlock>
            </Label>

            <ComboBox Grid.Column="1"
                      Grid.Row="0"
                      VerticalAlignment="Center"
                      HorizontalAlignment="Stretch"
                      Margin="6"
                      SelectedItem="{Binding Path=ConnectorRenderingMode}"
                      ItemsSource="{Binding Path=ValidRenderingModes}">
            </ComboBox>

            <Label Grid.Column="0"
                   Grid.Row="1"
                   VerticalAlignment="Center"
                   HorizontalAlignment="Left"
                   Margin="5,0,0,0">
                <TextBlock TextWrapping="Wrap">Size:</TextBlock>
            </Label>

            <TextBox Grid.Column="1"
                     Grid.Row="1"
                     VerticalAlignment="Center"
                     HorizontalAlignment="Stretch"
                     Margin="6"
                     Text="{Binding Path=ConnectorSize}">
                <Interactivity:Interaction.Behaviors>
                    <SEBehaviors:InheritingNumericTextBoxBehavior />
                </Interactivity:Interaction.Behaviors>
            </TextBox>

            <Label Grid.Column="0"
                   Grid.Row="2"
                   VerticalAlignment="Center"
                   HorizontalAlignment="Left"
                   Margin="5,0,0,0">
                <TextBlock TextWrapping="Wrap">Thickness:</TextBlock>
            </Label>

            <TextBox Grid.Column="1"
                     Grid.Row="2"
                     VerticalAlignment="Center"
                     HorizontalAlignment="Stretch"
                     Margin="6"
                     Text="{Binding Path=ConnectorStrokeThickness}">
                <Interactivity:Interaction.Behaviors>
                    <SEBehaviors:InheritingNumericTextBoxBehavior />
                </Interactivity:Interaction.Behaviors>
            </TextBox>

            <Label Grid.Column="0"
                   Grid.Row="3"
                   VerticalAlignment="Center"
                   HorizontalAlignment="Left"
                   Margin="5,0,0,0">
                <TextBlock TextWrapping="Wrap">Visible:</TextBlock>
            </Label>

            <CheckBox Grid.Column="1"
                      Grid.Row="3"
                      Margin="6"
                      VerticalAlignment="Center"
                      IsChecked="{Binding Path=ConnectorVisible}"></CheckBox>

            <Label Grid.Column="0"
                   Grid.Row="4"
                   VerticalAlignment="Center"
                   HorizontalAlignment="Left"
                   Margin="5,0,0,0">
                <TextBlock TextWrapping="Wrap">Filled:</TextBlock>
            </Label>

            <CheckBox Grid.Column="1"
                      Grid.Row="4"
                      Margin="6"
                      VerticalAlignment="Center"
                      IsChecked="{Binding Path=ConnectorFilled}"></CheckBox>

            <Label Grid.Column="0"
                   Grid.Row="5"
                   VerticalAlignment="Center"
                   HorizontalAlignment="Left"
                   Margin="5,0,0,0">
                <TextBlock TextWrapping="Wrap">Fill:</TextBlock>
            </Label>

            <Grid Grid.Column="1"
                  Grid.Row="5"
                  VerticalAlignment="Center"
                  HorizontalAlignment="Stretch"
                  Margin="6">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition></ColumnDefinition>
                    <ColumnDefinition Width="0.20*"></ColumnDefinition>
                </Grid.ColumnDefinitions>

                <ComboBox Grid.Column="0"
                          Grid.ColumnSpan="2"
                          VerticalAlignment="Center"
                          HorizontalAlignment="Stretch"
                          SelectedValue="{Binding Path=ConnectorFill, Converter={Converters:SolidColorBrushToColorConverter}}"
                          ItemsSource="{Binding Path=ValidColors}"
                          SelectedValuePath="Color">
                    <ComboBox.ItemTemplate>
                        <DataTemplate>
                            <Grid Margin="2">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                                    <ColumnDefinition></ColumnDefinition>
                                </Grid.ColumnDefinitions>
                                <Rectangle Fill="{Binding Path=Color, Converter={Converters:ColorToSolidColorBrushConverter}}"
                                           Width="15"
                                           Height="15"
                                           Margin="0,1,2,1"
                                           HorizontalAlignment="Center"
                                           VerticalAlignment="Center"
                                           Grid.Column="0"
                                           Stroke="White"
                                           StrokeThickness="0.05">
                                </Rectangle>
                                <TextBlock Text="{Binding Path=Label}"
                                           HorizontalAlignment="Left"
                                           VerticalAlignment="Center"
                                           Grid.Column="1"
                                           Margin="5,0,0,0"></TextBlock>
                            </Grid>
                        </DataTemplate>
                    </ComboBox.ItemTemplate>
                    <ComboBox.ItemsPanel>
                        <ItemsPanelTemplate>
                            <VirtualizingStackPanel />
                        </ItemsPanelTemplate>
                    </ComboBox.ItemsPanel>
                </ComboBox>
                <Button Grid.Column="1"
                        VerticalAlignment="Stretch"
                        HorizontalAlignment="Right"
                        VerticalContentAlignment="Center"
                        MinWidth="30"
                        Content="..."
                        Visibility="Collapsed"></Button>
                <!--We'll return to the advanced feature later, launching a custom color dialog we'll have to change the column span for the selector-->
            </Grid>

            <Grid Grid.Column="1"
                  Grid.Row="6"
                  Margin="6">            
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="0.50*"></ColumnDefinition>
                    <ColumnDefinition></ColumnDefinition>
                </Grid.ColumnDefinitions>

                <Label Grid.Column="0"
                       VerticalAlignment="Center"
                       Margin="5,0,0,0">Fill Preview:</Label>
                <Rectangle Grid.Column="1"
                           HorizontalAlignment="Left"
                           VerticalAlignment="Stretch"
                           Width="125"
                           Fill="{Binding Path=ConnectorFill, Converter={Converters:ColorToSolidColorBrushConverter}}"
                           Stroke="DarkGoldenrod"
                           Margin="6,3,6,3"></Rectangle>
            </Grid>

            <Label Grid.Column="0"
                   Grid.Row="7"
                   VerticalAlignment="Center"
                   HorizontalAlignment="Left"
                   Margin="5,0,0,0">
                <TextBlock TextWrapping="Wrap">Stroke:</TextBlock>
            </Label>

            <Grid Grid.Column="1"
                  Grid.Row="7"
                  VerticalAlignment="Center"
                  HorizontalAlignment="Stretch"
                  Margin="6">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition></ColumnDefinition>
                    <ColumnDefinition Width="0.20*"></ColumnDefinition>
                </Grid.ColumnDefinitions>

                <ComboBox Grid.Column="0"
                          Grid.ColumnSpan="2"
                          VerticalAlignment="Center"
                          HorizontalAlignment="Stretch"
                          SelectedValue="{Binding Path=ConnectorStroke, Converter={Converters:SolidColorBrushToColorConverter}}"
                          ItemsSource="{Binding Path=ValidColors}"
                          SelectedValuePath="Color">
                    <ComboBox.ItemTemplate>
                        <DataTemplate>
                            <Grid Margin="2">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                                    <ColumnDefinition></ColumnDefinition>
                                </Grid.ColumnDefinitions>
                                <Rectangle Fill="{Binding Path=Color, Converter={Converters:ColorToSolidColorBrushConverter}}"
                                           Width="15"
                                           Height="15"
                                           Margin="0,1,2,1"
                                           HorizontalAlignment="Center"
                                           VerticalAlignment="Center"
                                           Grid.Column="0"
                                           Stroke="White"
                                           StrokeThickness="0.05">
                                </Rectangle>
                                <TextBlock Text="{Binding Path=Label}"
                                           HorizontalAlignment="Left"
                                           VerticalAlignment="Center"
                                           Grid.Column="1"
                                           Margin="5,0,0,0"></TextBlock>
                            </Grid>
                        </DataTemplate>
                    </ComboBox.ItemTemplate>
                    <ComboBox.ItemsPanel>
                        <ItemsPanelTemplate>
                            <VirtualizingStackPanel />
                        </ItemsPanelTemplate>
                    </ComboBox.ItemsPanel>
                </ComboBox>
                <Button Grid.Column="1"
                        VerticalAlignment="Stretch"
                        HorizontalAlignment="Right"
                        VerticalContentAlignment="Center"
                        MinWidth="30"
                        Content="..."
                        Visibility="Collapsed"></Button>
                <!--We'll return to the advanced feature later, launching a custom color dialog we'll have to change the column span for the selector-->
            </Grid>

            <Grid Grid.Column="1"
                  Grid.Row="8"
                  Margin="6">     
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="0.50*"></ColumnDefinition>
                    <ColumnDefinition></ColumnDefinition>
                </Grid.ColumnDefinitions>

                <Label Grid.Column="0"
                       VerticalAlignment="Center"
                       Margin="5,0,0,0">Stroke Preview:</Label>
                <Rectangle Grid.Column="1"
                           HorizontalAlignment="Left"
                           VerticalAlignment="Stretch"
                           Width="125"
                           Fill="{Binding Path=ConnectorStroke, Converter={Converters:ColorToSolidColorBrushConverter}}"
                           Stroke="DarkGoldenrod"
                           Margin="6,3,6,3"></Rectangle>
            </Grid>
        </Grid>
    </DataTemplate>
    
    <DataTemplate x:Key="NucleotideGlobalRenderingOptionsTemplate" DataType="{x:Type ViewModels:NucleotideVisualRenderingOptionsViewModel}">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"></RowDefinition>
            </Grid.RowDefinitions>

            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="0.3*"></ColumnDefinition>
                <ColumnDefinition></ColumnDefinition>
            </Grid.ColumnDefinitions>

            <Label Grid.Column="0"
                   Grid.Row="0"
                   VerticalAlignment="Center"
                   HorizontalAlignment="Left"
                   Margin="5,0,0,0">
                <TextBlock TextWrapping="Wrap">Rendering Style:</TextBlock>
            </Label>

            <ComboBox Grid.Column="1"
                      Grid.Row="0"
                      VerticalAlignment="Center"
                      HorizontalAlignment="Stretch"
                      Margin="6"
                      SelectedItem="{Binding Path=RenderingMode}"
                      ItemsSource="{Binding Path=ValidRenderingModes}">
            </ComboBox>
        </Grid>
    </DataTemplate>

    <DataTemplate x:Key="NucleotideCircleRenderingOptionsTemplate" DataType="{x:Type ViewModels:NucleotideVisualRenderingOptionsViewModel}">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="40"></RowDefinition>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="40"></RowDefinition>
            </Grid.RowDefinitions>

            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="0.3*"></ColumnDefinition>
                <ColumnDefinition></ColumnDefinition>
            </Grid.ColumnDefinitions>

            <Label Grid.Column="0"
                   Grid.Row="0"
                   VerticalAlignment="Center"
                   HorizontalAlignment="Left"
                   Margin="5,0,0,0">Diameter:</Label>

            <TextBox Grid.Column="1"
                     Grid.Row="0"
                     VerticalAlignment="Center"
                     HorizontalAlignment="Stretch"
                     Margin="6"
                     Text="{Binding Path=CircleDiameter}">
                <Interactivity:Interaction.Behaviors>
                    <SEBehaviors:InheritingNumericTextBoxBehavior />
                </Interactivity:Interaction.Behaviors>
            </TextBox>

            <Label Grid.Column="0"
                   Grid.Row="1"
                   VerticalAlignment="Center"
                   HorizontalAlignment="Left"
                   Margin="5,0,0,0">
                <TextBlock TextWrapping="Wrap">Edge Thickness:</TextBlock>
            </Label>

            <TextBox Grid.Column="1"
                     Grid.Row="1"
                     VerticalAlignment="Center"
                     HorizontalAlignment="Stretch"
                     Margin="6"
                     Text="{Binding Path=CircleEdgeThickness}">
                <Interactivity:Interaction.Behaviors>
                    <SEBehaviors:InheritingNumericTextBoxBehavior />
                </Interactivity:Interaction.Behaviors>
            </TextBox>

            <Label Grid.Column="0"
                   Grid.Row="2"
                   VerticalAlignment="Center"
                   HorizontalAlignment="Left"
                   Margin="5,0,0,0">Filled:</Label>
            <CheckBox Grid.Column="1"
                      Grid.Row="2"
                      Margin="6"
                      VerticalAlignment="Center"
                      IsChecked="{Binding Path=CircleIsFilled}"></CheckBox>

            <Label Grid.Column="0"
                   Grid.Row="3"
                   VerticalAlignment="Center"
                   HorizontalAlignment="Left"
                   Margin="5,0,0,0">Stroke:</Label>

            <Grid Grid.Column="1"
                  Grid.Row="3"
                  VerticalAlignment="Center"
                  HorizontalAlignment="Stretch"
                  Margin="6">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition></ColumnDefinition>
                    <ColumnDefinition Width="0.20*"></ColumnDefinition>
                </Grid.ColumnDefinitions>

                <ComboBox Grid.Column="0"
                          Grid.ColumnSpan="2"
                          VerticalAlignment="Center"
                          HorizontalAlignment="Stretch"
                          SelectedValue="{Binding Path=CircleStroke, Converter={Converters:SolidColorBrushToColorConverter}}"
                          ItemsSource="{Binding Path=ValidColors}"
                          SelectedValuePath="Color">
                    <ComboBox.ItemTemplate>
                        <DataTemplate>
                            <Grid Margin="2">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                                    <ColumnDefinition></ColumnDefinition>
                                </Grid.ColumnDefinitions>
                                <Rectangle Fill="{Binding Path=Color, Converter={Converters:ColorToSolidColorBrushConverter}}"
                                           Width="15"
                                           Height="15"
                                           Margin="0,1,2,1"
                                           HorizontalAlignment="Center"
                                           VerticalAlignment="Center"
                                           Grid.Column="0"
                                           Stroke="White"
                                           StrokeThickness="0.05">
                                </Rectangle>
                                <TextBlock Text="{Binding Path=Label}"
                                           HorizontalAlignment="Left"
                                           VerticalAlignment="Center"
                                           Grid.Column="1"
                                           Margin="5,0,0,0"></TextBlock>
                            </Grid>
                        </DataTemplate>
                    </ComboBox.ItemTemplate>
                    <ComboBox.ItemsPanel>
                        <ItemsPanelTemplate>
                            <VirtualizingStackPanel />
                        </ItemsPanelTemplate>
                    </ComboBox.ItemsPanel>
                </ComboBox>
                <Button Grid.Column="1"
                        VerticalAlignment="Stretch"
                        HorizontalAlignment="Right"
                        VerticalContentAlignment="Center"
                        MinWidth="30"
                        Content="..."
                        Visibility="Collapsed"></Button><!--We'll return to the advanced feature later, launching a custom color dialog we'll have to change the column span for the selector-->
            </Grid>

            <Grid Grid.Column="1"
                  Grid.Row="4"
                  Margin="6">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="0.5*"></ColumnDefinition>
                    <ColumnDefinition></ColumnDefinition>
                </Grid.ColumnDefinitions>

                <Label Grid.Column="0"
                       VerticalAlignment="Center"
                       Margin="5,0,0,0">Stroke Preview:</Label>
                <Rectangle Grid.Column="1"
                           HorizontalAlignment="Left"
                           VerticalAlignment="Stretch"
                           Width="125"
                           Fill="{Binding Path=CircleStroke, Converter={Converters:ColorToSolidColorBrushConverter}}"
                           Stroke="DarkGoldenrod"
                           Margin="6,3,6,3"></Rectangle>
            </Grid>

            <Label Grid.Column="0"
                   Grid.Row="5"
                   VerticalAlignment="Center"
                   HorizontalAlignment="Left"
                   Margin="5,0,0,0">Fill:</Label>

            <Grid Grid.Column="1"
                  Grid.Row="5"
                  VerticalAlignment="Center"
                  HorizontalAlignment="Stretch"
                  Margin="6">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition></ColumnDefinition>
                    <ColumnDefinition Width="0.20*"></ColumnDefinition>
                </Grid.ColumnDefinitions>

                <ComboBox Grid.Column="0"
                          Grid.ColumnSpan="2"
                          VerticalAlignment="Center"
                          HorizontalAlignment="Stretch"
                          SelectedValue="{Binding Path=CircleFill, Converter={Converters:SolidColorBrushToColorConverter}}"
                          ItemsSource="{Binding Path=ValidColors}"
                          SelectedValuePath="Color">
                    <ComboBox.ItemTemplate>
                        <DataTemplate>
                            <Grid Margin="2">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                                    <ColumnDefinition></ColumnDefinition>
                                </Grid.ColumnDefinitions>
                                <Rectangle Fill="{Binding Path=Color, Converter={Converters:ColorToSolidColorBrushConverter}}"
                                           Width="15"
                                           Height="15"
                                           Margin="0,1,2,1"
                                           HorizontalAlignment="Center"
                                           VerticalAlignment="Center"
                                           Grid.Column="0"
                                           Stroke="White"
                                           StrokeThickness="0.05">
                                </Rectangle>
                                <TextBlock Text="{Binding Path=Label}"
                                           HorizontalAlignment="Left"
                                           VerticalAlignment="Center"
                                           Grid.Column="1"
                                           Margin="5,0,0,0"></TextBlock>
                            </Grid>
                        </DataTemplate>
                    </ComboBox.ItemTemplate>
                    <ComboBox.ItemsPanel>
                        <ItemsPanelTemplate>
                            <VirtualizingStackPanel />
                        </ItemsPanelTemplate>
                    </ComboBox.ItemsPanel>
                </ComboBox>
                <Button Grid.Column="1"
                        VerticalAlignment="Stretch"
                        HorizontalAlignment="Right"
                        VerticalContentAlignment="Center"
                        MinWidth="30"
                        Content="..."
                        Visibility="Collapsed"></Button><!--We'll return to the advanced feature later, launching a custom color dialog we'll have to change the column span for the selector-->
            </Grid>

            <Grid Grid.Column="1"
                  Grid.Row="6"
                  Margin="6">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="0.5*"></ColumnDefinition>
                    <ColumnDefinition></ColumnDefinition>
                </Grid.ColumnDefinitions>

                <Label Grid.Column="0"
                       VerticalAlignment="Center"
                       Margin="5,0,0,0">Fill Preview:</Label>
                <Rectangle Grid.Column="1"
                           HorizontalAlignment="Left"
                           VerticalAlignment="Stretch"
                           Width="125"
                           Fill="{Binding Path=CircleFill, Converter={Converters:ColorToSolidColorBrushConverter}}"
                           Stroke="DarkGoldenrod"
                           Margin="6,3,6,3"></Rectangle>
            </Grid>
        </Grid>
    </DataTemplate>

    <DataTemplate x:Key="NucleotideTextRenderingOptionsTemplate" DataType="{x:Type ViewModels:NucleotideVisualRenderingOptionsViewModel}">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="40"></RowDefinition>
            </Grid.RowDefinitions>

            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="0.3*"></ColumnDefinition>
                <ColumnDefinition></ColumnDefinition>
            </Grid.ColumnDefinitions>

            <Label Grid.Column="0"
                   Grid.Row="0"
                   VerticalAlignment="Center"
                   HorizontalAlignment="Left"
                   Margin="5,0,0,0">Font:</Label>
            <ComboBox Grid.Column="1"
                      Grid.Row="0"
                      VerticalAlignment="Center"
                      HorizontalAlignment="Stretch"
                      Margin="6"
                      SelectedItem="{Binding Path=TextFont}"
                      ItemsSource="{Binding Path=ValidTextFonts}">
                <ComboBox.ItemTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding}" FontFamily="{Binding}"></TextBlock>
                    </DataTemplate>
                </ComboBox.ItemTemplate>
            </ComboBox>


            <Label Grid.Column="0"
                   Grid.Row="1"
                   VerticalAlignment="Center"
                   HorizontalAlignment="Left"
                   Margin="5,0,0,0">Style:</Label>

            <ComboBox Grid.Column="1"
                      Grid.Row="1"
                      VerticalAlignment="Center"
                      HorizontalAlignment="Stretch"
                      Margin="6"
                      SelectedItem="{Binding Path=TextStyle}"
                      ItemsSource="{Binding Path=ValidTextStyles}"></ComboBox>

            <Label Grid.Column="0"
                   Grid.Row="2"
                   VerticalAlignment="Center"
                   HorizontalAlignment="Left"
                   Margin="5,0,0,0">Weight:</Label>

            <ComboBox Grid.Column="1"
                      Grid.Row="2"
                      VerticalAlignment="Center"
                      HorizontalAlignment="Stretch"
                      Margin="6"
                      SelectedItem="{Binding Path=TextWeight}"
                      ItemsSource="{Binding Path=ValidTextWeights}"></ComboBox>

            <Label Grid.Column="0"
                   Grid.Row="3"
                   VerticalAlignment="Center"
                   HorizontalAlignment="Left"
                   Margin="5,0,0,0">Size:</Label>

            <ComboBox Grid.Column="1"
                      Grid.Row="3"
                      VerticalAlignment="Center"
                      HorizontalAlignment="Stretch"
                      Margin="6"
                      SelectedItem="{Binding Path=TextSize}"
                      ItemsSource="{Binding Path=ValidTextSizes}"></ComboBox>

            <Label Grid.Column="0"
                   Grid.Row="4"
                   VerticalAlignment="Center"
                   HorizontalAlignment="Left"
                   Margin="5,0,0,0">Fill:</Label>

            <Grid Grid.Column="1"
                  Grid.Row="4"
                  VerticalAlignment="Center"
                  HorizontalAlignment="Stretch"
                  Margin="6">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition></ColumnDefinition>
                    <ColumnDefinition Width="0.20*"></ColumnDefinition>
                </Grid.ColumnDefinitions>

                <ComboBox Grid.Column="0"
                          Grid.ColumnSpan="2"
                          VerticalAlignment="Center"
                          HorizontalAlignment="Stretch"
                          SelectedValue="{Binding Path=TextFill, Converter={Converters:SolidColorBrushToColorConverter}}"
                          ItemsSource="{Binding Path=ValidColors}"
                          SelectedValuePath="Color">
                    <ComboBox.ItemTemplate>
                        <DataTemplate>
                            <Grid Margin="2">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                                    <ColumnDefinition></ColumnDefinition>
                                </Grid.ColumnDefinitions>
                                <Rectangle Fill="{Binding Path=Color, Converter={Converters:ColorToSolidColorBrushConverter}}"
                                           Width="15"
                                           Height="15"
                                           Margin="0,1,2,1"
                                           HorizontalAlignment="Center"
                                           VerticalAlignment="Center"
                                           Grid.Column="0"
                                           Stroke="White"
                                           StrokeThickness="0.05">
                                </Rectangle>
                                <TextBlock Text="{Binding Path=Label}"
                                           HorizontalAlignment="Left"
                                           VerticalAlignment="Center"
                                           Grid.Column="1"
                                           Margin="5,0,0,0"></TextBlock>
                            </Grid>
                        </DataTemplate>
                    </ComboBox.ItemTemplate>
                    <ComboBox.ItemsPanel>
                        <ItemsPanelTemplate>
                            <VirtualizingStackPanel />
                        </ItemsPanelTemplate>
                    </ComboBox.ItemsPanel>
                </ComboBox>
                <Button Grid.Column="1"
                        VerticalAlignment="Stretch"
                        HorizontalAlignment="Right"
                        VerticalContentAlignment="Center"
                        MinWidth="30"
                        Content="..."
                        Visibility="Collapsed"></Button><!--We'll return to the advanced feature later, launching a custom color dialog we'll have to change the column span for the selector-->
            </Grid>

            <Grid Grid.Column="1"
                  Grid.Row="5"
                  Margin="6">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="0.5*"></ColumnDefinition>
                    <ColumnDefinition></ColumnDefinition>
                </Grid.ColumnDefinitions>

                <Label Grid.Column="0"
                       VerticalAlignment="Center"
                       Margin="5,0,0,0">Fill Preview:</Label>
                <Rectangle Grid.Column="1"
                           HorizontalAlignment="Left"
                           VerticalAlignment="Stretch"
                           Width="125"
                           Fill="{Binding Path=TextFill, Converter={Converters:ColorToSolidColorBrushConverter}}"
                           Stroke="DarkGoldenrod"
                           Margin="6,3,6,3"></Rectangle>
            </Grid>
        </Grid>
    </DataTemplate>
</ResourceDictionary>